var Pokerface = {
    // fields
    _components: {},
    
    // protected methods
    //

    // public
    addComponent: function(component) {
        var name = component.getName();
        if (!this._components[name]) {
            this._components[name] = component;
        }
    },

    start: function(handlerName) {
        if (!handlerName) {
            var handlerElement = $('.handler');
            if (!handlerElement.length) {
                throw 'no elements with js handlers';
            }
            handlerName = handlerElement.first().attr('data-js-handler');
        }
        if (!handlerName) {
            throw 'no handler inside handler element';
        }
        if (!this._components[handlerName]) {
            throw 'missed handler: ' + handlerName;
        }
        this._components[handlerName].start();
    }
}

